In [5]:
%matplotlib inline
from __future__ import division
import pandas as pd
import sqlalchemy as sq
import matplotlib.pyplot as plt

Loading of the table fom the databse

The code gets from the databse the column D_CONBM_kg, it is a long column with over 18MM rows.


In [23]:
engine = sq.create_engine('postgresql+pg8000://jdlara:Amadeus-2010@switch-db2.erg.berkeley.edu:5432/apl_cec?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory')
df_lemma = pd.read_sql_query('select "D_CONBM_kg" from lemma.lemma_crmort where ("D_CONBM_kg" > 1 and "D_CONBM_kg" < 60000)',engine)

In [24]:
plt.figure()
df_lemma.plot.hist(bins=30)


Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x1102e6510>
<matplotlib.figure.Figure at 0x1102e6cd0>

In [25]:
df_lemma_high = pd.read_sql_query('select "D_CONBM_kg" from lemma.lemma_crmort where ("D_CONBM_kg" > 60000)',engine)

In [26]:
plt.figure()
df_lemma_high.plot.hist(bins=30)


Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x1f15c6710>
<matplotlib.figure.Figure at 0x1f15c2350>

In [ ]: